/*
 *  Scenario.h
 *  MapEdit
 *
 *  Created by Steven Canfield on 7/6/07.
 *
 */

#import <Cocoa/Cocoa.h>

/* Strings */
struct chk_str_t {
	u_int16_t count;
	u_int16_t offset[ 1024 ];
};
typedef struct chk_str_t chk_str_t;

void swap_chk_str( chk_str_t * str );


/* Create Unit With Trigger */
struct chk_uprp_t {
	u_int16_t	valid_status;
	u_int16_t	valid_element;
	u_int8_t	owner;
	u_int8_t	health_percent;
	u_int8_t	shield_percent;
	u_int8_t	energy_percent;
	u_int32_t	resource;
	u_int16_t	hanger_count;
	u_int16_t	status;
	u_int32_t	unknown1;
};
typedef struct chk_uprp_t chk_uprp_t;

/* Create Unit With Trigger Used */
struct chk_upus_t {
	u_int8_t used[64];
};
typedef struct chk_upus_t chk_upus_t;

/* Regions */
struct chk_mrgn_t {
	u_int32_t	start_x;
	u_int32_t	start_y;
	u_int32_t	end_x;
	u_int32_t	end_y;
	u_int16_t	name_index;
	u_int16_t	elevation_flags;
};
typedef struct chk_mrgn_t chk_mrgn_t;

void swap_chk_mrgn( chk_mrgn_t * mrgn );

/* Triggers */

struct chk_condition_t {
	u_int32_t	location;
	u_int32_t	group;
	u_int32_t	amount;
	u_int16_t	unit_type;
	u_int8_t	comparison_type;
	u_int8_t	condition_type;
	u_int8_t	condition_modifier;
	u_int8_t	flags;
	u_int16_t	unknown;
};
typedef struct chk_condition_t chk_condition_t;

struct chk_action_t {
	u_int32_t	source_location;
	u_int32_t	text_index;
	u_int32_t	sound_index;
	u_int32_t	time;
	u_int32_t	primary_group;
	u_int32_t	secondary_group;
	u_int16_t	action_modifier;
	u_int8_t	action_type;
	u_int8_t	number;
	u_int8_t	flags;
	u_int8_t	unknown[3];
};
typedef struct chk_action_t chk_action_t;

struct chk_trig_t {
	chk_condition_t conditions[ 16 ];
	chk_action_t	actions[ 64 ];
	u_int32_t		padding;
	u_int8_t		enabled_for_player[ 28 ];
};
typedef struct chk_trig_t chk_trig_t;

/* Mission Briefing */

/* Scenario Properties */
struct chk_sprp_t {
	u_int16_t	name_index;
	u_int16_t	desc_index;
};
typedef struct chk_sprp_t chk_sprp_t;

/* WAV Sounds */
struct chk_wav_t {
	u_int16_t path_index[1024];
};
typedef struct chk_wav_t chk_wav_t;

/* Switch Renaming Section */
struct chk_swnm_t {
	u_int32_t switch_name[256];
};
typedef struct chk_swnm_t chk_swnm_t;